package net.osc.dao;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

import net.osc.util.PageBean;

import org.springframework.orm.hibernate3.HibernateCallback;

public interface HibernateDao {

	public void save(Object entity);

	public <T> void saveAll(Collection<T> entities);

	public void delete(Object entity);

	public <T> void deleteAll(Collection<T> entities);

	public int bulkUpdate(String hql, Object... values);

	public int bulkUpdateBySQL(final String sql, final Object... values);

	public <T> T exec(HibernateCallback<T> hibernateCallback);

	public <T> T get(Class<T> clazz, Serializable id);

	public <T> T load(Class<T> clazz, Serializable id);

	public <T> List<T> loadAll(Class<T> clazz);

	public <T> List<T> find(String hql);

	public <T> List<T> find(String hql, Object... values);

	public <T> List<T> findBySQL(String sql);

	public <T> List<T> findBySQL(String sql, Object... values);

	public <T> T findBySQLUniqueResult(String sql, Object... values);

	public <T> List<T> findByNamedParam(String hql, String[] paramNames, Object[] params);

	public <T> List<T> findByNamedParam(String hql, String[] paramNames, Object[] params,
			String[] listParamNames, Collection<?>[] listParams);

	public <T> T findUniqueResult(String hql, Object... values);

	public <T> T findByNamedParamUniqueResult(String hql, String[] paramNames, Object[] params);

	public <T> T findByNamedParamUniqueResult(String hql, String[] paramNames, Object[] params,
			String[] listParamNames, Collection<?>[] listParams);

	public <T> List<T> findBySQLNamedParam(String sql, String[] paramNames, Object[] params);

	public <T> List<T> findBySQLNamedParam(String sql, String[] paramNames, Object[] params,
			String[] listParamNames, Collection<?>[] listParams);

	public <T> T findBySQLNamedParamUniqueResult(String sql, String[] paramNames, Object[] params);

	public <T> T findBySQLNamedParamUniqueResult(String sql, String[] paramNames, Object[] params,
			String[] listParamNames, Collection<?>[] listParams);

	public <T> PageBean<T> findByNamedParamPageQuery(String hql, String[] paramNames,
			Object[] params, PageBean<T> pageBean);

	public <T> PageBean<T> findByNamedParamPageQuery(String hql, String[] paramNames,
			Object[] params, String[] listParamNames, Collection<?>[] listParams,
			PageBean<T> pageBean);

	public <T> PageBean<T> findBySQLNamedParamPageQuery(String sql, String[] paramNames,
			Object[] params, PageBean<T> pageBean);

	public <T> PageBean<T> findBySQLNamedParamPageQuery(String sql, String[] paramNames,
			Object[] params, String[] listParamNames, Collection<?>[] listParams,
			PageBean<T> pageBean);

}
